#include "widget.h"
#include "ui_widget.h"
#include <QCalendar>
#include <QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    time = new QTimer(this);
    connect(time, &QTimer::timeout, this, &Widget::handle);
    //开启定时器
    time->start(100);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::handle()
{
    int value = ui->progressBar->value();
    if(value >= 100)
    {
        //关闭定时器
        time->stop();
        return;
    }
    ui->progressBar->setValue(value + 1);
}


void Widget::on_calendarWidget_activated(const QDate &date)
{

}

void Widget::on_calendarWidget_selectionChanged()
{
     QDate date = ui->calendarWidget->selectedDate();
     qDebug() << date;

     ui->label->setText(date.toString());
}
